package svc

import (
	"github.com/zeromicro/go-zero/zrpc"
	"go-exp/exp-test/nacos-test/client_demo/internal/config"
	"go-exp/exp-test/nacos-test/server_demo/serverdemoclient"
	// 关键: 导入 Nacos resolver 包，它会自动注册 "nacos" scheme
	_ "github.com/zeromicro/zero-contrib/zrpc/registry/nacos"
)

type ServiceContext struct {
	Config        config.Config
	ServerDemoRpc serverdemoclient.ServerDemo
}

func NewServiceContext(c config.Config) *ServiceContext {
	return &ServiceContext{
		Config:        c,
		ServerDemoRpc: serverdemoclient.NewServerDemo(zrpc.MustNewClient(c.ServerDemoRpc)),
	}
}
